package org.dawnsql.stock.controller;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import org.dawnsql.stock.model.DataItem;
import org.dawnsql.stock.model.StackData;
import org.dawnsql.stock.util.MaiDian;
import org.dawnsql.stock.util.MyJs;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Controller
public class MyStockController {

    Gson gson = new GsonBuilder()
            .enableComplexMapKeySerialization()
            .setDateFormat("yyyy-MM-dd HH:mm:ss")
            .create();

    Connection conn = null;
    public MyStockController() throws ClassNotFoundException, SQLException {
        Class.forName("org.h2.Driver");
        this.conn = DriverManager.getConnection("jdbc:h2:~/data;AUTO_SERVER=TRUE", "root", "root");
    }

    @RequestMapping(value = "/stock_data")
    public @ResponseBody
    String stock_data(ModelMap model, HttpServletRequest request,
                   HttpServletResponse response,
                   @RequestParam(value = "code", required = false) String code) throws UnsupportedEncodingException {

        Gson gson = new GsonBuilder()
                .enableComplexMapKeySerialization()
                .setDateFormat("yyyy-MM-dd HH:mm:ss")
                .create();
        String line = "{\"ticker\":\"BABA\",\"queryCount\":3506,\"resultsCount\":311,\"adjusted\":true,\"results\":[{\"v\":30493,\"vw\":94.7968,\"o\":94.82,\"c\":94.7,\"h\":94.88,\"l\":94.7,\"t\":1692011520000,\"n\":353},{\"v\":23493,\"vw\":94.6893,\"o\":94.73,\"c\":94.6,\"h\":94.77,\"l\":94.6,\"t\":1692012420000,\"n\":276},{\"v\":25708,\"vw\":94.4844,\"o\":94.56,\"c\":94.5,\"h\":94.56,\"l\":94.37,\"t\":1692013320000,\"n\":387},{\"v\":40954,\"vw\":94.6233,\"o\":94.54,\"c\":94.49,\"h\":94.895,\"l\":94.33,\"t\":1692014220000,\"n\":464},{\"v\":28489,\"vw\":94.3685,\"o\":94.48,\"c\":94.315,\"h\":94.49,\"l\":94.2158,\"t\":1692015120000,\"n\":367},{\"v\":27544,\"vw\":94.179,\"o\":94.28,\"c\":94.26,\"h\":94.32,\"l\":94.02,\"t\":1692016020000,\"n\":462},{\"v\":27146,\"vw\":94.2495,\"o\":94.2,\"c\":94.3,\"h\":94.39,\"l\":94.15,\"t\":1692016920000,\"n\":237},{\"v\":25619,\"vw\":94.2708,\"o\":94.3,\"c\":94.28,\"h\":94.3765,\"l\":94.13,\"t\":1692017820000,\"n\":261},{\"v\":21591,\"vw\":94.1776,\"o\":94.25,\"c\":94.25,\"h\":94.25,\"l\":94.1,\"t\":1692018720000,\"n\":331},{\"v\":2.388929e+06,\"vw\":93.2654,\"o\":94.28,\"c\":92.9,\"h\":94.39,\"l\":92.53,\"t\":1692019620000,\"n\":23315},{\"v\":1.440338e+06,\"vw\":93.264,\"o\":92.91,\"c\":93.45,\"h\":93.79,\"l\":92.73,\"t\":1692020520000,\"n\":14714},{\"v\":1.195968e+06,\"vw\":93.5007,\"o\":93.45,\"c\":93.36,\"h\":93.83,\"l\":93.23,\"t\":1692021420000,\"n\":12346},{\"v\":780267,\"vw\":93.3659,\"o\":93.36,\"c\":93.27,\"h\":93.54,\"l\":93.13,\"t\":1692022320000,\"n\":9376},{\"v\":633793,\"vw\":93.4014,\"o\":93.2833,\"c\":93.42,\"h\":93.58,\"l\":93.18,\"t\":1692023220000,\"n\":7776},{\"v\":722572,\"vw\":93.3997,\"o\":93.425,\"c\":93.2525,\"h\":93.59,\"l\":93.21,\"t\":1692024120000,\"n\":8382},{\"v\":856830,\"vw\":93.0842,\"o\":93.26,\"c\":92.8,\"h\":93.33,\"l\":92.78,\"t\":1692025020000,\"n\":9054},{\"v\":791800,\"vw\":93.137,\"o\":92.8,\"c\":93.455,\"h\":93.47,\"l\":92.77,\"t\":1692025920000,\"n\":7879},{\"v\":599245,\"vw\":93.7057,\"o\":93.46,\"c\":93.89,\"h\":93.9499,\"l\":93.36,\"t\":1692026820000,\"n\":6448},{\"v\":488974,\"vw\":94.003,\"o\":93.9008,\"c\":94.035,\"h\":94.1091,\"l\":93.85,\"t\":1692027720000,\"n\":5326},{\"v\":528578,\"vw\":94.2121,\"o\":94.035,\"c\":94.17,\"h\":94.45,\"l\":93.9,\"t\":1692028620000,\"n\":5239},{\"v\":480076,\"vw\":93.9327,\"o\":94.16,\"c\":93.704,\"h\":94.21,\"l\":93.7,\"t\":1692029520000,\"n\":4398},{\"v\":263949,\"vw\":93.7808,\"o\":93.715,\"c\":93.76,\"h\":93.8815,\"l\":93.665,\"t\":1692030420000,\"n\":4131},{\"v\":273798,\"vw\":93.7551,\"o\":93.7699,\"c\":93.63,\"h\":93.91,\"l\":93.629,\"t\":1692031320000,\"n\":6253},{\"v\":208889,\"vw\":93.6588,\"o\":93.62,\"c\":93.73,\"h\":93.73,\"l\":93.5849,\"t\":1692032220000,\"n\":4319},{\"v\":233625,\"vw\":93.783,\"o\":93.73,\"c\":93.7733,\"h\":93.9152,\"l\":93.66,\"t\":1692033120000,\"n\":3476},{\"v\":278117,\"vw\":93.7292,\"o\":93.77,\"c\":93.64,\"h\":93.84,\"l\":93.635,\"t\":1692034020000,\"n\":3868},{\"v\":356411,\"vw\":93.5724,\"o\":93.65,\"c\":93.59,\"h\":93.655,\"l\":93.5007,\"t\":1692034920000,\"n\":4146},{\"v\":219982,\"vw\":93.6202,\"o\":93.59,\"c\":93.69,\"h\":93.69,\"l\":93.5401,\"t\":1692035820000,\"n\":3318},{\"v\":277755,\"vw\":93.6465,\"o\":93.68,\"c\":93.7319,\"h\":93.795,\"l\":93.57,\"t\":1692036720000,\"n\":3253},{\"v\":187007,\"vw\":93.7576,\"o\":93.74,\"c\":93.77,\"h\":93.84,\"l\":93.6388,\"t\":1692037620000,\"n\":2643},{\"v\":256595,\"vw\":93.7057,\"o\":93.77,\"c\":93.735,\"h\":93.79,\"l\":93.611,\"t\":1692038520000,\"n\":3156},{\"v\":276126,\"vw\":93.7542,\"o\":93.735,\"c\":93.735,\"h\":93.85,\"l\":93.665,\"t\":1692039420000,\"n\":3181},{\"v\":246614,\"vw\":93.7998,\"o\":93.74,\"c\":93.7278,\"h\":93.89,\"l\":93.7216,\"t\":1692040320000,\"n\":3099},{\"v\":305581,\"vw\":93.7175,\"o\":93.73,\"c\":93.84,\"h\":93.86,\"l\":93.6,\"t\":1692041220000,\"n\":4349},{\"v\":794503,\"vw\":93.5973,\"o\":93.845,\"c\":93.525,\"h\":93.845,\"l\":93.51,\"t\":1692042120000,\"n\":9893},{\"v\":593559,\"vw\":93.5259,\"o\":93.525,\"c\":93.55,\"h\":93.98,\"l\":93.46,\"t\":1692043020000,\"n\":5173},{\"v\":13943,\"vw\":93.6265,\"o\":93.55,\"c\":93.65,\"h\":93.68,\"l\":93.54,\"t\":1692043920000,\"n\":143},{\"v\":232580,\"vw\":93.4726,\"o\":93.6,\"c\":93.67,\"h\":93.79,\"l\":93.46,\"t\":1692044820000,\"n\":124},{\"v\":3928,\"vw\":93.5592,\"o\":93.6599,\"c\":93.59,\"h\":93.6599,\"l\":93.46,\"t\":1692045720000,\"n\":52},{\"v\":1302,\"vw\":93.6243,\"o\":93.66,\"c\":93.58,\"h\":93.67,\"l\":93.58,\"t\":1692046620000,\"n\":18},{\"v\":4126,\"vw\":93.7069,\"o\":93.69,\"c\":93.8,\"h\":93.8,\"l\":93.66,\"t\":1692047520000,\"n\":54},{\"v\":748,\"vw\":93.8186,\"o\":93.84,\"c\":93.75,\"h\":93.84,\"l\":93.75,\"t\":1692048420000,\"n\":16},{\"v\":3029,\"vw\":93.717,\"o\":93.7,\"c\":93.73,\"h\":93.75,\"l\":93.63,\"t\":1692049320000,\"n\":35},{\"v\":3844,\"vw\":93.6691,\"o\":93.7,\"c\":93.68,\"h\":93.73,\"l\":93.61,\"t\":1692050220000,\"n\":46},{\"v\":4103,\"vw\":93.7241,\"o\":93.66,\"c\":93.84,\"h\":93.84,\"l\":93.66,\"t\":1692051120000,\"n\":28},{\"v\":5139,\"vw\":93.8017,\"o\":93.75,\"c\":93.78,\"h\":93.84,\"l\":93.74,\"t\":1692052020000,\"n\":39},{\"v\":17966,\"vw\":93.8696,\"o\":93.77,\"c\":93.82,\"h\":93.89,\"l\":93.72,\"t\":1692052920000,\"n\":36},{\"v\":1429,\"vw\":93.7659,\"o\":93.8,\"c\":93.76,\"h\":93.81,\"l\":93.73,\"t\":1692053820000,\"n\":26},{\"v\":3364,\"vw\":93.7896,\"o\":93.76,\"c\":93.77,\"h\":93.88,\"l\":93.76,\"t\":1692054720000,\"n\":43},{\"v\":2120,\"vw\":93.8007,\"o\":93.82,\"c\":93.77,\"h\":93.83,\"l\":93.76,\"t\":1692055620000,\"n\":18},{\"v\":15307,\"vw\":93.74,\"o\":93.78,\"c\":93.8,\"h\":93.8,\"l\":93.65,\"t\":1692056520000,\"n\":105},{\"v\":3214,\"vw\":93.7208,\"o\":93.7,\"c\":93.8,\"h\":93.8,\"l\":93.67,\"t\":1692057420000,\"n\":40},{\"v\":13465,\"vw\":93.268,\"o\":93.52,\"c\":93.15,\"h\":93.52,\"l\":93.1,\"t\":1692086220000,\"n\":182},{\"v\":3614,\"vw\":93.0385,\"o\":93,\"c\":93,\"h\":93.11,\"l\":93,\"t\":1692087120000,\"n\":56},{\"v\":1712,\"vw\":92.9131,\"o\":92.95,\"c\":92.95,\"h\":92.95,\"l\":92.9,\"t\":1692088020000,\"n\":33},{\"v\":8321,\"vw\":93.1338,\"o\":92.92,\"c\":93.11,\"h\":93.46,\"l\":92.92,\"t\":1692088920000,\"n\":64},{\"v\":2048,\"vw\":93.0477,\"o\":93.21,\"c\":93.04,\"h\":93.21,\"l\":93.03,\"t\":1692089820000,\"n\":11},{\"v\":328,\"vw\":93.21,\"o\":93.21,\"c\":93.21,\"h\":93.21,\"l\":93.21,\"t\":1692091620000,\"n\":4},{\"v\":13555,\"vw\":93.4254,\"o\":93.3,\"c\":93.42,\"h\":93.44,\"l\":93.3,\"t\":1692092520000,\"n\":55},{\"v\":3560,\"vw\":93.1977,\"o\":93.31,\"c\":93.18,\"h\":93.31,\"l\":93.17,\"t\":1692093420000,\"n\":16},{\"v\":6048,\"vw\":93.031,\"o\":93.2,\"c\":92.92,\"h\":93.2,\"l\":92.89,\"t\":1692094320000,\"n\":82},{\"v\":7165,\"vw\":92.9067,\"o\":92.95,\"c\":92.79,\"h\":92.99,\"l\":92.79,\"t\":1692095220000,\"n\":68},{\"v\":2230,\"vw\":92.9294,\"o\":92.94,\"c\":92.92,\"h\":92.94,\"l\":92.9,\"t\":1692096120000,\"n\":26},{\"v\":15747,\"vw\":92.8491,\"o\":92.98,\"c\":92.85,\"h\":93.01,\"l\":92.74,\"t\":1692097020000,\"n\":163},{\"v\":6120,\"vw\":92.8588,\"o\":92.83,\"c\":92.85,\"h\":92.91,\"l\":92.75,\"t\":1692097920000,\"n\":99},{\"v\":8142,\"vw\":92.9882,\"o\":92.94,\"c\":92.9,\"h\":93.1,\"l\":92.9,\"t\":1692098820000,\"n\":115},{\"v\":5385,\"vw\":92.9098,\"o\":92.91,\"c\":92.9,\"h\":92.95,\"l\":92.9,\"t\":1692099720000,\"n\":78},{\"v\":51558,\"vw\":93.003,\"o\":92.87,\"c\":92.93,\"h\":93.9,\"l\":92.8,\"t\":1692100620000,\"n\":376},{\"v\":9897,\"vw\":92.9339,\"o\":92.9,\"c\":92.9001,\"h\":93,\"l\":92.9,\"t\":1692101520000,\"n\":107},{\"v\":25956,\"vw\":92.7841,\"o\":92.98,\"c\":92.83,\"h\":93,\"l\":92.68,\"t\":1692102420000,\"n\":261},{\"v\":38562,\"vw\":92.8627,\"o\":92.7201,\"c\":92.85,\"h\":93,\"l\":92.7201,\"t\":1692103320000,\"n\":144},{\"v\":25651,\"vw\":92.9571,\"o\":92.9,\"c\":93,\"h\":93.08,\"l\":92.8,\"t\":1692104220000,\"n\":243},{\"v\":21418,\"vw\":93.1424,\"o\":93.1,\"c\":93.1,\"h\":93.19,\"l\":93.06,\"t\":1692105120000,\"n\":244},{\"v\":1.193793e+06,\"vw\":92.4484,\"o\":93,\"c\":92.2,\"h\":93.01,\"l\":92.05,\"t\":1692106020000,\"n\":12190},{\"v\":1.77239e+06,\"vw\":91.823,\"o\":92.23,\"c\":91.7,\"h\":92.255,\"l\":91.56,\"t\":1692106920000,\"n\":16922},{\"v\":1.709313e+06,\"vw\":91.1353,\"o\":91.7,\"c\":91.1075,\"h\":91.74,\"l\":90.7446,\"t\":1692107820000,\"n\":16415},{\"v\":990403,\"vw\":91.0038,\"o\":91.0901,\"c\":91.16,\"h\":91.185,\"l\":90.79,\"t\":1692108720000,\"n\":9872},{\"v\":722960,\"vw\":91.1509,\"o\":91.16,\"c\":91.195,\"h\":91.335,\"l\":91.01,\"t\":1692109620000,\"n\":7852},{\"v\":642095,\"vw\":91.5195,\"o\":91.2,\"c\":91.77,\"h\":91.77,\"l\":91.19,\"t\":1692110520000,\"n\":6627},{\"v\":407467,\"vw\":91.7358,\"o\":91.77,\"c\":91.7612,\"h\":91.87,\"l\":91.56,\"t\":1692111420000,\"n\":4513},{\"v\":288546,\"vw\":91.7062,\"o\":91.76,\"c\":91.67,\"h\":91.8,\"l\":91.625,\"t\":1692112320000,\"n\":3373},{\"v\":420978,\"vw\":91.8499,\"o\":91.677,\"c\":91.83,\"h\":91.94,\"l\":91.677,\"t\":1692113220000,\"n\":4099},{\"v\":377922,\"vw\":91.7977,\"o\":91.83,\"c\":91.76,\"h\":91.87,\"l\":91.72,\"t\":1692114120000,\"n\":3330},{\"v\":505862,\"vw\":91.6198,\"o\":91.755,\"c\":91.5006,\"h\":91.889,\"l\":91.36,\"t\":1692115020000,\"n\":5220},{\"v\":238812,\"vw\":91.5363,\"o\":91.51,\"c\":91.6001,\"h\":91.62,\"l\":91.4,\"t\":1692115920000,\"n\":2979},{\"v\":260787,\"vw\":91.5387,\"o\":91.6,\"c\":91.55,\"h\":91.64,\"l\":91.47,\"t\":1692116820000,\"n\":3433},{\"v\":396180,\"vw\":91.4362,\"o\":91.55,\"c\":91.5363,\"h\":91.59,\"l\":91.43,\"t\":1692117720000,\"n\":3436},{\"v\":236236,\"vw\":91.5023,\"o\":91.54,\"c\":91.56,\"h\":91.605,\"l\":91.41,\"t\":1692118620000,\"n\":3072},{\"v\":184109,\"vw\":91.5856,\"o\":91.575,\"c\":91.56,\"h\":91.635,\"l\":91.52,\"t\":1692119520000,\"n\":2449},{\"v\":185388,\"vw\":91.5275,\"o\":91.55,\"c\":91.4611,\"h\":91.605,\"l\":91.445,\"t\":1692120420000,\"n\":2492},{\"v\":356440,\"vw\":91.3667,\"o\":91.45,\"c\":91.43,\"h\":91.45,\"l\":91.241,\"t\":1692121320000,\"n\":3269},{\"v\":212125,\"vw\":91.3724,\"o\":91.44,\"c\":91.37,\"h\":91.45,\"l\":91.31,\"t\":1692122220000,\"n\":2806},{\"v\":197500,\"vw\":91.3883,\"o\":91.37,\"c\":91.35,\"h\":91.45,\"l\":91.335,\"t\":1692123120000,\"n\":2647},{\"v\":216752,\"vw\":91.4525,\"o\":91.34,\"c\":91.49,\"h\":91.56,\"l\":91.31,\"t\":1692124020000,\"n\":2865},{\"v\":316076,\"vw\":91.6181,\"o\":91.5,\"c\":91.65,\"h\":91.71,\"l\":91.5,\"t\":1692124920000,\"n\":3108},{\"v\":204569,\"vw\":91.6164,\"o\":91.65,\"c\":91.5843,\"h\":91.69,\"l\":91.53,\"t\":1692125820000,\"n\":2533},{\"v\":362359,\"vw\":91.4631,\"o\":91.58,\"c\":91.325,\"h\":91.585,\"l\":91.288,\"t\":1692126720000,\"n\":3540},{\"v\":394614,\"vw\":91.4047,\"o\":91.33,\"c\":91.495,\"h\":91.495,\"l\":91.315,\"t\":1692127620000,\"n\":4630},{\"v\":768921,\"vw\":91.5786,\"o\":91.495,\"c\":91.74,\"h\":91.77,\"l\":91.415,\"t\":1692128520000,\"n\":9633},{\"v\":567795,\"vw\":91.6387,\"o\":91.745,\"c\":91.6,\"h\":91.755,\"l\":91.51,\"t\":1692129420000,\"n\":4829},{\"v\":5720,\"vw\":91.5791,\"o\":91.59,\"c\":91.55,\"h\":91.6,\"l\":91.55,\"t\":1692130320000,\"n\":46},{\"v\":17937,\"vw\":91.3981,\"o\":91.56,\"c\":91.36,\"h\":91.56,\"l\":91.32,\"t\":1692131220000,\"n\":142},{\"v\":20653,\"vw\":91.392,\"o\":91.37,\"c\":91.39,\"h\":91.59,\"l\":91.29,\"t\":1692132120000,\"n\":132},{\"v\":4815,\"vw\":91.3719,\"o\":91.37,\"c\":91.38,\"h\":91.39,\"l\":91.33,\"t\":1692133020000,\"n\":43},{\"v\":3281,\"vw\":91.2532,\"o\":91.3,\"c\":91.22,\"h\":91.31,\"l\":91.22,\"t\":1692133920000,\"n\":29},{\"v\":2926,\"vw\":91.3222,\"o\":91.29,\"c\":91.37,\"h\":91.37,\"l\":91.27,\"t\":1692134820000,\"n\":31},{\"v\":2133,\"vw\":91.4279,\"o\":91.37,\"c\":91.3,\"h\":91.49,\"l\":91.3,\"t\":1692135720000,\"n\":27},{\"v\":4037,\"vw\":91.4765,\"o\":91.49,\"c\":91.33,\"h\":91.54,\"l\":91.31,\"t\":1692136620000,\"n\":48},{\"v\":7588,\"vw\":91.5518,\"o\":91.5,\"c\":91.52,\"h\":91.59,\"l\":91.43,\"t\":1692137520000,\"n\":26},{\"v\":6054,\"vw\":91.5435,\"o\":91.5011,\"c\":91.56,\"h\":91.59,\"l\":91.5,\"t\":1692138420000,\"n\":41},{\"v\":2964,\"vw\":91.5741,\"o\":91.4802,\"c\":91.55,\"h\":91.59,\"l\":91.4802,\"t\":1692139320000,\"n\":17},{\"v\":1837,\"vw\":91.4891,\"o\":91.46,\"c\":91.48,\"h\":91.55,\"l\":91.46,\"t\":1692140220000,\"n\":17},{\"v\":2748,\"vw\":91.5411,\"o\":91.53,\"c\":91.55,\"h\":91.55,\"l\":91.5,\"t\":1692141120000,\"n\":26},{\"v\":5074,\"vw\":91.5849,\"o\":91.55,\"c\":91.63,\"h\":91.71,\"l\":91.55,\"t\":1692142020000,\"n\":54},{\"v\":7809,\"vw\":91.5692,\"o\":91.64,\"c\":91.55,\"h\":91.65,\"l\":91.55,\"t\":1692142920000,\"n\":33},{\"v\":861,\"vw\":91.5672,\"o\":91.55,\"c\":91.6,\"h\":91.6,\"l\":91.55,\"t\":1692143820000,\"n\":16},{\"v\":5980,\"vw\":91.1249,\"o\":91.15,\"c\":91.15,\"h\":91.15,\"l\":91.07,\"t\":1692172620000,\"n\":101},{\"v\":2903,\"vw\":91.0808,\"o\":91.11,\"c\":91.02,\"h\":91.11,\"l\":91.02,\"t\":1692173520000,\"n\":38},{\"v\":9521,\"vw\":90.8648,\"o\":91.05,\"c\":90.85,\"h\":91.05,\"l\":90.8,\"t\":1692174420000,\"n\":96},{\"v\":15549,\"vw\":90.7042,\"o\":90.85,\"c\":90.6,\"h\":90.9,\"l\":90.6,\"t\":1692175320000,\"n\":127},{\"v\":10070,\"vw\":90.6067,\"o\":90.51,\"c\":90.6,\"h\":90.74,\"l\":90.51,\"t\":1692176220000,\"n\":106},{\"v\":6068,\"vw\":90.5323,\"o\":90.6,\"c\":90.55,\"h\":90.6,\"l\":90.5,\"t\":1692177120000,\"n\":55},{\"v\":3144,\"vw\":90.6018,\"o\":90.6,\"c\":90.6,\"h\":90.7,\"l\":90.51,\"t\":1692178020000,\"n\":60},{\"v\":4084,\"vw\":90.4805,\"o\":90.57,\"c\":90.41,\"h\":90.57,\"l\":90.41,\"t\":1692178920000,\"n\":78},{\"v\":10752,\"vw\":90.6309,\"o\":90.41,\"c\":90.7,\"h\":90.89,\"l\":90.41,\"t\":1692179820000,\"n\":137},{\"v\":5870,\"vw\":90.5326,\"o\":90.5,\"c\":90.5,\"h\":90.6,\"l\":90.4,\"t\":1692180720000,\"n\":89},{\"v\":14485,\"vw\":90.3158,\"o\":90.51,\"c\":90.24,\"h\":90.58,\"l\":90.17,\"t\":1692181620000,\"n\":225},{\"v\":30714,\"vw\":89.9363,\"o\":90.24,\"c\":89.76,\"h\":90.24,\"l\":89.71,\"t\":1692182520000,\"n\":505},{\"v\":30544,\"vw\":89.9436,\"o\":89.76,\"c\":89.8,\"h\":90.15,\"l\":89.75,\"t\":1692183420000,\"n\":639},{\"v\":13875,\"vw\":89.6945,\"o\":89.78,\"c\":89.65,\"h\":89.8,\"l\":89.6,\"t\":1692184320000,\"n\":259},{\"v\":6677,\"vw\":89.7382,\"o\":89.63,\"c\":89.85,\"h\":89.87,\"l\":89.62,\"t\":1692185220000,\"n\":132},{\"v\":10041,\"vw\":89.8051,\"o\":89.91,\"c\":89.84,\"h\":89.91,\"l\":89.76,\"t\":1692186120000,\"n\":195},{\"v\":90572,\"vw\":89.8995,\"o\":89.9,\"c\":89.83,\"h\":90.96,\"l\":89.57,\"t\":1692187020000,\"n\":980},{\"v\":46666,\"vw\":89.8859,\"o\":89.8101,\"c\":89.75,\"h\":89.96,\"l\":89.75,\"t\":1692187920000,\"n\":473},{\"v\":52777,\"vw\":90.4118,\"o\":89.8,\"c\":89.97,\"h\":89.97,\"l\":89.7,\"t\":1692188820000,\"n\":428},{\"v\":81486,\"vw\":90.0115,\"o\":89.94,\"c\":89.93,\"h\":90.25,\"l\":89.82,\"t\":1692189720000,\"n\":563},{\"v\":27806,\"vw\":89.987,\"o\":89.9,\"c\":90.01,\"h\":90.1,\"l\":89.88,\"t\":1692190620000,\"n\":427},{\"v\":38052,\"vw\":89.9414,\"o\":90.05,\"c\":89.7,\"h\":90.05,\"l\":89.63,\"t\":1692191520000,\"n\":513},{\"v\":3.353349e+06,\"vw\":88.8775,\"o\":89.75,\"c\":88.7832,\"h\":89.78,\"l\":88.32,\"t\":1692192420000,\"n\":30712},{\"v\":2.466103e+06,\"vw\":88.8436,\"o\":88.7801,\"c\":88.97,\"h\":89.19,\"l\":88.29,\"t\":1692193320000,\"n\":23029},{\"v\":1.401723e+06,\"vw\":89.2245,\"o\":88.969,\"c\":89.23,\"h\":89.485,\"l\":88.9688,\"t\":1692194220000,\"n\":12485},{\"v\":1.554393e+06,\"vw\":89.5424,\"o\":89.23,\"c\":89.81,\"h\":89.87,\"l\":89.18,\"t\":1692195120000,\"n\":14476},{\"v\":1.464952e+06,\"vw\":89.9226,\"o\":89.815,\"c\":89.98,\"h\":90.17,\"l\":89.58,\"t\":1692196020000,\"n\":13895},{\"v\":1.157217e+06,\"vw\":90.2796,\"o\":89.97,\"c\":90.1075,\"h\":90.5,\"l\":89.95,\"t\":1692196920000,\"n\":10916},{\"v\":625203,\"vw\":90.0228,\"o\":90.09,\"c\":90.09,\"h\":90.29,\"l\":89.77,\"t\":1692197820000,\"n\":6012},{\"v\":420644,\"vw\":89.9199,\"o\":90.1,\"c\":89.71,\"h\":90.115,\"l\":89.67,\"t\":1692198720000,\"n\":4698},{\"v\":428557,\"vw\":89.5746,\"o\":89.71,\"c\":89.45,\"h\":89.77,\"l\":89.42,\"t\":1692199620000,\"n\":5158},{\"v\":748518,\"vw\":89.2549,\"o\":89.45,\"c\":89.13,\"h\":89.46,\"l\":89.1,\"t\":1692200520000,\"n\":6214},{\"v\":532043,\"vw\":89.1943,\"o\":89.12,\"c\":89.14,\"h\":89.29,\"l\":89.07,\"t\":1692201420000,\"n\":5053},{\"v\":811109,\"vw\":89.3575,\"o\":89.14,\"c\":89.74,\"h\":89.74,\"l\":89.1,\"t\":1692202320000,\"n\":6479},{\"v\":383267,\"vw\":89.7935,\"o\":89.7389,\"c\":89.87,\"h\":89.94,\"l\":89.5624,\"t\":1692203220000,\"n\":4013},{\"v\":310631,\"vw\":89.8102,\"o\":89.87,\"c\":89.755,\"h\":89.915,\"l\":89.68,\"t\":1692204120000,\"n\":3696},{\"v\":294795,\"vw\":89.7239,\"o\":89.75,\"c\":89.725,\"h\":89.87,\"l\":89.635,\"t\":1692205020000,\"n\":3302},{\"v\":198814,\"vw\":89.7669,\"o\":89.73,\"c\":89.74,\"h\":89.83,\"l\":89.69,\"t\":1692205920000,\"n\":2832},{\"v\":217932,\"vw\":89.7002,\"o\":89.73,\"c\":89.8,\"h\":89.84,\"l\":89.62,\"t\":1692206820000,\"n\":2938},{\"v\":395680,\"vw\":89.8669,\"o\":89.805,\"c\":89.885,\"h\":89.95,\"l\":89.77,\"t\":1692207720000,\"n\":3911},{\"v\":373641,\"vw\":89.6239,\"o\":89.885,\"c\":89.4929,\"h\":89.89,\"l\":89.45,\"t\":1692208620000,\"n\":4526},{\"v\":417908,\"vw\":89.5831,\"o\":89.49,\"c\":89.625,\"h\":89.8,\"l\":89.38,\"t\":1692209520000,\"n\":4641},{\"v\":243625,\"vw\":89.7513,\"o\":89.62,\"c\":89.75,\"h\":89.86,\"l\":89.605,\"t\":1692210420000,\"n\":3305},{\"v\":402323,\"vw\":89.453,\"o\":89.77,\"c\":89.32,\"h\":89.7786,\"l\":89.25,\"t\":1692211320000,\"n\":4476},{\"v\":486687,\"vw\":89.3062,\"o\":89.3188,\"c\":89.11,\"h\":89.45,\"l\":89.11,\"t\":1692212220000,\"n\":5206},{\"v\":861033,\"vw\":89.0947,\"o\":89.1001,\"c\":89.2019,\"h\":89.2399,\"l\":88.9601,\"t\":1692213120000,\"n\":8596},{\"v\":686479,\"vw\":89.1072,\"o\":89.2,\"c\":89.14,\"h\":89.25,\"l\":88.96,\"t\":1692214020000,\"n\":7724},{\"v\":1.030303e+06,\"vw\":89.2759,\"o\":89.14,\"c\":89.31,\"h\":89.42,\"l\":89.1,\"t\":1692214920000,\"n\":11911},{\"v\":596000,\"vw\":89.2521,\"o\":89.305,\"c\":89.11,\"h\":89.355,\"l\":89,\"t\":1692215820000,\"n\":5233},{\"v\":12720,\"vw\":89.0798,\"o\":89.1,\"c\":89.08,\"h\":89.12,\"l\":89.05,\"t\":1692216720000,\"n\":89},{\"v\":22090,\"vw\":89.087,\"o\":89.0799,\"c\":89.01,\"h\":89.12,\"l\":89.01,\"t\":1692217620000,\"n\":71},{\"v\":1139,\"vw\":89.0694,\"o\":89.06,\"c\":89.06,\"h\":89.08,\"l\":89.06,\"t\":1692218520000,\"n\":12},{\"v\":9202,\"vw\":89.0713,\"o\":89.05,\"c\":89.08,\"h\":89.08,\"l\":89.05,\"t\":1692219420000,\"n\":49},{\"v\":5197,\"vw\":88.7539,\"o\":89.0501,\"c\":89.0023,\"h\":89.1,\"l\":89,\"t\":1692220320000,\"n\":53},{\"v\":3048,\"vw\":89.0984,\"o\":89,\"c\":89.12,\"h\":89.1586,\"l\":89,\"t\":1692221220000,\"n\":19},{\"v\":2333,\"vw\":89.1344,\"o\":89.15,\"c\":89.11,\"h\":89.16,\"l\":89.11,\"t\":1692222120000,\"n\":24},{\"v\":1904,\"vw\":89.1154,\"o\":89.11,\"c\":89.12,\"h\":89.13,\"l\":89.1018,\"t\":1692223020000,\"n\":26},{\"v\":3564,\"vw\":89.1129,\"o\":89.1102,\"c\":89.14,\"h\":89.14,\"l\":89.1,\"t\":1692223920000,\"n\":51},{\"v\":2045,\"vw\":89.0971,\"o\":89.09,\"c\":89.1,\"h\":89.1,\"l\":89.08,\"t\":1692224820000,\"n\":19},{\"v\":2377,\"vw\":89.1164,\"o\":89.1,\"c\":89.12,\"h\":89.12,\"l\":89.1,\"t\":1692225720000,\"n\":16},{\"v\":3422,\"vw\":89.146,\"o\":89.13,\"c\":89.16,\"h\":89.16,\"l\":89.12,\"t\":1692226620000,\"n\":40},{\"v\":8845,\"vw\":89.184,\"o\":89.15,\"c\":89.22,\"h\":89.23,\"l\":89.12,\"t\":1692227520000,\"n\":55},{\"v\":2508,\"vw\":89.1602,\"o\":89.1994,\"c\":89.14,\"h\":89.1994,\"l\":89.14,\"t\":1692228420000,\"n\":16},{\"v\":14435,\"vw\":88.9925,\"o\":89.15,\"c\":88.88,\"h\":89.21,\"l\":88.81,\"t\":1692229320000,\"n\":173},{\"v\":4175,\"vw\":88.8623,\"o\":88.88,\"c\":88.82,\"h\":88.88,\"l\":88.82,\"t\":1692230220000,\"n\":48},{\"v\":51523,\"vw\":91.7788,\"o\":91.62,\"c\":91.8,\"h\":92,\"l\":91.31,\"t\":1692259020000,\"n\":631},{\"v\":14441,\"vw\":91.7915,\"o\":91.76,\"c\":91.75,\"h\":91.85,\"l\":91.71,\"t\":1692259920000,\"n\":173},{\"v\":10680,\"vw\":91.7073,\"o\":91.75,\"c\":91.6,\"h\":91.75,\"l\":91.6,\"t\":1692260820000,\"n\":119},{\"v\":15490,\"vw\":91.5535,\"o\":91.6,\"c\":91.42,\"h\":91.63,\"l\":91.42,\"t\":1692261720000,\"n\":91},{\"v\":4359,\"vw\":91.5011,\"o\":91.47,\"c\":91.6,\"h\":91.6,\"l\":91.42,\"t\":1692262620000,\"n\":109},{\"v\":9553,\"vw\":91.5136,\"o\":91.47,\"c\":91.53,\"h\":91.59,\"l\":91.46,\"t\":1692263520000,\"n\":69},{\"v\":3717,\"vw\":91.484,\"o\":91.52,\"c\":91.42,\"h\":91.52,\"l\":91.42,\"t\":1692264420000,\"n\":41},{\"v\":9269,\"vw\":91.6271,\"o\":91.41,\"c\":91.73,\"h\":91.75,\"l\":91.41,\"t\":1692265320000,\"n\":107},{\"v\":26671,\"vw\":91.9891,\"o\":91.72,\"c\":92.28,\"h\":92.28,\"l\":91.7,\"t\":1692266220000,\"n\":313},{\"v\":11909,\"vw\":92.1055,\"o\":92.2,\"c\":92.09,\"h\":92.26,\"l\":92.04,\"t\":1692267120000,\"n\":151},{\"v\":12965,\"vw\":92.07,\"o\":92.07,\"c\":91.92,\"h\":92.15,\"l\":91.81,\"t\":1692268020000,\"n\":141},{\"v\":8677,\"vw\":92.0144,\"o\":91.92,\"c\":92,\"h\":92.07,\"l\":91.92,\"t\":1692268920000,\"n\":138},{\"v\":30511,\"vw\":91.7733,\"o\":91.95,\"c\":91.89,\"h\":91.95,\"l\":91.68,\"t\":1692269820000,\"n\":382},{\"v\":20273,\"vw\":91.8896,\"o\":91.85,\"c\":91.92,\"h\":91.97,\"l\":91.82,\"t\":1692270720000,\"n\":227},{\"v\":22274,\"vw\":91.8084,\"o\":91.88,\"c\":91.78,\"h\":91.88,\"l\":91.72,\"t\":1692271620000,\"n\":218},{\"v\":19443,\"vw\":91.7353,\"o\":91.76,\"c\":91.74,\"h\":91.8,\"l\":91.64,\"t\":1692272520000,\"n\":226},{\"v\":92590,\"vw\":91.7303,\"o\":91.69,\"c\":91.61,\"h\":92.2,\"l\":90.59,\"t\":1692273420000,\"n\":791},{\"v\":31833,\"vw\":91.6617,\"o\":91.65,\"c\":91.65,\"h\":91.75,\"l\":91.59,\"t\":1692274320000,\"n\":247},{\"v\":76033,\"vw\":91.7136,\"o\":91.69,\"c\":91.64,\"h\":91.8,\"l\":91.64,\"t\":1692275220000,\"n\":654},{\"v\":32859,\"vw\":91.6789,\"o\":91.65,\"c\":91.64,\"h\":91.73,\"l\":91.61,\"t\":1692276120000,\"n\":263},{\"v\":74293,\"vw\":91.445,\"o\":91.64,\"c\":91.4,\"h\":91.6896,\"l\":91.36,\"t\":1692277020000,\"n\":746},{\"v\":78591,\"vw\":91.4932,\"o\":91.36,\"c\":91.5,\"h\":91.6684,\"l\":91.3,\"t\":1692277920000,\"n\":592},{\"v\":1.767173e+06,\"vw\":91.2911,\"o\":91.5,\"c\":91.4199,\"h\":91.95,\"l\":90.8019,\"t\":1692278820000,\"n\":17429},{\"v\":1.73395e+06,\"vw\":91.1217,\"o\":91.4194,\"c\":90.85,\"h\":91.68,\"l\":90.6,\"t\":1692279720000,\"n\":16596},{\"v\":929186,\"vw\":91.1376,\"o\":90.86,\"c\":91.07,\"h\":91.41,\"l\":90.74,\"t\":1692280620000,\"n\":8916},{\"v\":801786,\"vw\":91.0885,\"o\":91.07,\"c\":90.89,\"h\":91.45,\"l\":90.75,\"t\":1692281520000,\"n\":7214},{\"v\":899935,\"vw\":90.7638,\"o\":90.89,\"c\":91.12,\"h\":91.1299,\"l\":90.56,\"t\":1692282420000,\"n\":8167},{\"v\":650956,\"vw\":91.2305,\"o\":91.1099,\"c\":91.2005,\"h\":91.4,\"l\":91.03,\"t\":1692283320000,\"n\":6266},{\"v\":445448,\"vw\":91.2082,\"o\":91.2,\"c\":91.26,\"h\":91.365,\"l\":91,\"t\":1692284220000,\"n\":5101},{\"v\":288146,\"vw\":91.0416,\"o\":91.26,\"c\":90.84,\"h\":91.29,\"l\":90.81,\"t\":1692285120000,\"n\":3802},{\"v\":424985,\"vw\":90.9097,\"o\":90.85,\"c\":91.02,\"h\":91.08,\"l\":90.78,\"t\":1692286020000,\"n\":5303},{\"v\":431957,\"vw\":91.2161,\"o\":91.03,\"c\":91.19,\"h\":91.4,\"l\":91.015,\"t\":1692286920000,\"n\":4538},{\"v\":367693,\"vw\":91.1355,\"o\":91.18,\"c\":91.22,\"h\":91.28,\"l\":90.9501,\"t\":1692287820000,\"n\":4160},{\"v\":286212,\"vw\":91.269,\"o\":91.21,\"c\":91.45,\"h\":91.48,\"l\":91.11,\"t\":1692288720000,\"n\":3078},{\"v\":450833,\"vw\":91.4064,\"o\":91.445,\"c\":91.215,\"h\":91.54,\"l\":91.18,\"t\":1692289620000,\"n\":3486},{\"v\":173361,\"vw\":91.2585,\"o\":91.21,\"c\":91.31,\"h\":91.34,\"l\":91.19,\"t\":1692290520000,\"n\":2108},{\"v\":225633,\"vw\":91.3506,\"o\":91.32,\"c\":91.25,\"h\":91.42,\"l\":91.24,\"t\":1692291420000,\"n\":2875},{\"v\":207812,\"vw\":91.2495,\"o\":91.24,\"c\":91.185,\"h\":91.33,\"l\":91.18,\"t\":1692292320000,\"n\":2332},{\"v\":256569,\"vw\":91.093,\"o\":91.19,\"c\":90.9712,\"h\":91.231,\"l\":90.97,\"t\":1692293220000,\"n\":2851},{\"v\":243608,\"vw\":90.8264,\"o\":90.98,\"c\":90.72,\"h\":90.98,\"l\":90.715,\"t\":1692294120000,\"n\":2838},{\"v\":218729,\"vw\":90.771,\"o\":90.735,\"c\":90.7886,\"h\":90.82,\"l\":90.71,\"t\":1692295020000,\"n\":2732},{\"v\":279423,\"vw\":90.6037,\"o\":90.785,\"c\":90.615,\"h\":90.81,\"l\":90.52,\"t\":1692295920000,\"n\":3218},{\"v\":222341,\"vw\":90.6226,\"o\":90.6299,\"c\":90.68,\"h\":90.72,\"l\":90.5174,\"t\":1692296820000,\"n\":2615},{\"v\":294506,\"vw\":90.5377,\"o\":90.69,\"c\":90.46,\"h\":90.69,\"l\":90.4201,\"t\":1692297720000,\"n\":3423},{\"v\":298156,\"vw\":90.4866,\"o\":90.47,\"c\":90.37,\"h\":90.55,\"l\":90.37,\"t\":1692298620000,\"n\":3083},{\"v\":354645,\"vw\":90.3965,\"o\":90.365,\"c\":90.58,\"h\":90.59,\"l\":90.26,\"t\":1692299520000,\"n\":3772},{\"v\":383648,\"vw\":90.6187,\"o\":90.57,\"c\":90.71,\"h\":90.7301,\"l\":90.46,\"t\":1692300420000,\"n\":4680},{\"v\":716331,\"vw\":90.7317,\"o\":90.715,\"c\":90.69,\"h\":90.82,\"l\":90.64,\"t\":1692301320000,\"n\":8931},{\"v\":537093,\"vw\":90.6966,\"o\":90.695,\"c\":90.5987,\"h\":90.75,\"l\":90.49,\"t\":1692302220000,\"n\":4339},{\"v\":4740,\"vw\":90.6208,\"o\":90.58,\"c\":90.6089,\"h\":90.7,\"l\":90.56,\"t\":1692303120000,\"n\":61},{\"v\":1956,\"vw\":90.5707,\"o\":90.61,\"c\":90.5601,\"h\":90.61,\"l\":90.56,\"t\":1692304020000,\"n\":19},{\"v\":2502,\"vw\":90.5189,\"o\":90.58,\"c\":90.48,\"h\":90.58,\"l\":90.48,\"t\":1692304920000,\"n\":38},{\"v\":14826,\"vw\":90.4218,\"o\":90.481,\"c\":90.37,\"h\":90.49,\"l\":90.37,\"t\":1692305820000,\"n\":85},{\"v\":13405,\"vw\":90.2375,\"o\":90.37,\"c\":90.25,\"h\":90.37,\"l\":90.25,\"t\":1692306720000,\"n\":68},{\"v\":19856,\"vw\":90.2099,\"o\":90.27,\"c\":90.08,\"h\":90.3,\"l\":90.08,\"t\":1692307620000,\"n\":104},{\"v\":8501,\"vw\":90.0881,\"o\":90.0802,\"c\":90.06,\"h\":90.3,\"l\":90.05,\"t\":1692308520000,\"n\":104},{\"v\":32922,\"vw\":90.0474,\"o\":90.2255,\"c\":90,\"h\":90.2255,\"l\":90,\"t\":1692309420000,\"n\":178},{\"v\":15113,\"vw\":89.8656,\"o\":89.9,\"c\":89.99,\"h\":90.09,\"l\":89.8,\"t\":1692310320000,\"n\":116},{\"v\":7674,\"vw\":89.8396,\"o\":89.94,\"c\":89.86,\"h\":89.9443,\"l\":89.8,\"t\":1692311220000,\"n\":82},{\"v\":5115,\"vw\":89.8974,\"o\":89.86,\"c\":89.9,\"h\":90,\"l\":89.82,\"t\":1692312120000,\"n\":62},{\"v\":6334,\"vw\":89.9704,\"o\":90,\"c\":89.95,\"h\":90.03,\"l\":89.9,\"t\":1692313020000,\"n\":63},{\"v\":7054,\"vw\":89.998,\"o\":89.96,\"c\":90.1,\"h\":90.1,\"l\":89.92,\"t\":1692313920000,\"n\":62},{\"v\":3185,\"vw\":90.1327,\"o\":90.11,\"c\":90.2,\"h\":90.2,\"l\":90.02,\"t\":1692314820000,\"n\":34},{\"v\":14596,\"vw\":89.9939,\"o\":90.15,\"c\":89.88,\"h\":90.15,\"l\":89.88,\"t\":1692315720000,\"n\":88},{\"v\":2123,\"vw\":89.9152,\"o\":89.9,\"c\":89.85,\"h\":89.94,\"l\":89.85,\"t\":1692316620000,\"n\":22},{\"v\":34795,\"vw\":88.8038,\"o\":89.06,\"c\":88.7,\"h\":89.29,\"l\":88.55,\"t\":1692345420000,\"n\":296},{\"v\":14789,\"vw\":88.5673,\"o\":88.62,\"c\":88.61,\"h\":88.62,\"l\":88.53,\"t\":1692346320000,\"n\":133},{\"v\":7352,\"vw\":88.6103,\"o\":88.53,\"c\":88.57,\"h\":88.68,\"l\":88.53,\"t\":1692347220000,\"n\":70},{\"v\":14397,\"vw\":88.5004,\"o\":88.6,\"c\":88.35,\"h\":88.62,\"l\":88.35,\"t\":1692348120000,\"n\":165},{\"v\":12652,\"vw\":88.3224,\"o\":88.38,\"c\":88.21,\"h\":88.41,\"l\":88.21,\"t\":1692349020000,\"n\":129},{\"v\":13453,\"vw\":88.332,\"o\":88.25,\"c\":88.43,\"h\":88.43,\"l\":88.21,\"t\":1692349920000,\"n\":151},{\"v\":11220,\"vw\":88.2839,\"o\":88.31,\"c\":88.32,\"h\":88.36,\"l\":88.24,\"t\":1692350820000,\"n\":73},{\"v\":15444,\"vw\":88.2634,\"o\":88.22,\"c\":88.32,\"h\":88.34,\"l\":88.2,\"t\":1692351720000,\"n\":125},{\"v\":4364,\"vw\":88.3543,\"o\":88.35,\"c\":88.35,\"h\":88.42,\"l\":88.3,\"t\":1692352620000,\"n\":60},{\"v\":4072,\"vw\":88.3956,\"o\":88.35,\"c\":88.44,\"h\":88.46,\"l\":88.35,\"t\":1692353520000,\"n\":58},{\"v\":8629,\"vw\":88.3982,\"o\":88.35,\"c\":88.46,\"h\":88.55,\"l\":88.26,\"t\":1692354420000,\"n\":69},{\"v\":5933,\"vw\":88.332,\"o\":88.35,\"c\":88.4,\"h\":88.45,\"l\":88.26,\"t\":1692355320000,\"n\":57},{\"v\":21479,\"vw\":88.179,\"o\":88.35,\"c\":88,\"h\":88.5,\"l\":88,\"t\":1692356220000,\"n\":340},{\"v\":24311,\"vw\":88.0276,\"o\":88.02,\"c\":88.05,\"h\":88.06,\"l\":87.97,\"t\":1692357120000,\"n\":380},{\"v\":34269,\"vw\":87.9597,\"o\":88.06,\"c\":87.79,\"h\":88.11,\"l\":87.77,\"t\":1692358020000,\"n\":447},{\"v\":46752,\"vw\":87.7629,\"o\":87.87,\"c\":87.71,\"h\":87.87,\"l\":87.69,\"t\":1692358920000,\"n\":599},{\"v\":88877,\"vw\":88.0174,\"o\":87.71,\"c\":87.7,\"h\":89.97,\"l\":87.62,\"t\":1692359820000,\"n\":816},{\"v\":41738,\"vw\":87.6901,\"o\":87.68,\"c\":87.7,\"h\":87.76,\"l\":87.63,\"t\":1692360720000,\"n\":488},{\"v\":44772,\"vw\":87.6016,\"o\":87.66,\"c\":87.655,\"h\":87.7,\"l\":87.5,\"t\":1692361620000,\"n\":498},{\"v\":47880,\"vw\":87.5665,\"o\":87.65,\"c\":87.62,\"h\":87.65,\"l\":87.4705,\"t\":1692362520000,\"n\":473},{\"v\":29208,\"vw\":87.7591,\"o\":87.62,\"c\":87.8511,\"h\":87.9,\"l\":87.52,\"t\":1692363420000,\"n\":456},{\"v\":47481,\"vw\":87.9384,\"o\":87.85,\"c\":87.95,\"h\":88.06,\"l\":87.8,\"t\":1692364320000,\"n\":564},{\"v\":1.952121e+06,\"vw\":87.5823,\"o\":87.9,\"c\":87.4,\"h\":87.97,\"l\":87.3,\"t\":1692365220000,\"n\":17554},{\"v\":2.175272e+06,\"vw\":87.5865,\"o\":87.37,\"c\":87.415,\"h\":87.99,\"l\":87.04,\"t\":1692366120000,\"n\":17946},{\"v\":1.387749e+06,\"vw\":87.1528,\"o\":87.4101,\"c\":87.33,\"h\":87.515,\"l\":86.8611,\"t\":1692367020000,\"n\":13930},{\"v\":966660,\"vw\":87.1552,\"o\":87.34,\"c\":87.12,\"h\":87.409,\"l\":86.86,\"t\":1692367920000,\"n\":9145},{\"v\":830218,\"vw\":87.0723,\"o\":87.11,\"c\":87.19,\"h\":87.22,\"l\":86.91,\"t\":1692368820000,\"n\":7669},{\"v\":685387,\"vw\":87.3033,\"o\":87.195,\"c\":87.39,\"h\":87.49,\"l\":87.1279,\"t\":1692369720000,\"n\":6870},{\"v\":988278,\"vw\":87.6869,\"o\":87.39,\"c\":87.81,\"h\":87.9,\"l\":87.325,\"t\":1692370620000,\"n\":8107},{\"v\":916519,\"vw\":87.9631,\"o\":87.82,\"c\":87.91,\"h\":88.08,\"l\":87.79,\"t\":1692371520000,\"n\":7658},{\"v\":918236,\"vw\":87.6553,\"o\":87.91,\"c\":87.3488,\"h\":87.91,\"l\":87.3,\"t\":1692372420000,\"n\":7992},{\"v\":596034,\"vw\":87.7121,\"o\":87.35,\"c\":87.97,\"h\":88.08,\"l\":87.35,\"t\":1692373320000,\"n\":6230},{\"v\":655579,\"vw\":88.0758,\"o\":87.96,\"c\":87.96,\"h\":88.31,\"l\":87.79,\"t\":1692374220000,\"n\":6513},{\"v\":411883,\"vw\":87.816,\"o\":87.95,\"c\":87.795,\"h\":87.95,\"l\":87.705,\"t\":1692375120000,\"n\":3632},{\"v\":328466,\"vw\":87.7874,\"o\":87.785,\"c\":87.8,\"h\":87.9108,\"l\":87.695,\"t\":1692376020000,\"n\":4076},{\"v\":298433,\"vw\":87.842,\"o\":87.815,\"c\":87.83,\"h\":87.96,\"l\":87.75,\"t\":1692376920000,\"n\":3350},{\"v\":426782,\"vw\":87.8335,\"o\":87.82,\"c\":87.815,\"h\":87.94,\"l\":87.725,\"t\":1692377820000,\"n\":3650},{\"v\":364491,\"vw\":87.7852,\"o\":87.81,\"c\":87.76,\"h\":87.89,\"l\":87.67,\"t\":1692378720000,\"n\":3751},{\"v\":309565,\"vw\":87.9382,\"o\":87.76,\"c\":87.99,\"h\":88.08,\"l\":87.755,\"t\":1692379620000,\"n\":3264},{\"v\":325042,\"vw\":88.0607,\"o\":87.995,\"c\":88.03,\"h\":88.185,\"l\":87.94,\"t\":1692380520000,\"n\":3337},{\"v\":453861,\"vw\":88.147,\"o\":88.035,\"c\":87.96,\"h\":88.36,\"l\":87.96,\"t\":1692381420000,\"n\":4136},{\"v\":320542,\"vw\":88.0302,\"o\":87.9683,\"c\":87.975,\"h\":88.115,\"l\":87.9501,\"t\":1692382320000,\"n\":3350},{\"v\":272574,\"vw\":88.0919,\"o\":87.97,\"c\":88.11,\"h\":88.18,\"l\":87.97,\"t\":1692383220000,\"n\":2934},{\"v\":330202,\"vw\":88.052,\"o\":88.12,\"c\":88.04,\"h\":88.19,\"l\":87.96,\"t\":1692384120000,\"n\":3201},{\"v\":361440,\"vw\":87.9546,\"o\":88.04,\"c\":87.94,\"h\":88.045,\"l\":87.88,\"t\":1692385020000,\"n\":3541},{\"v\":378470,\"vw\":87.9688,\"o\":87.935,\"c\":87.995,\"h\":88.03,\"l\":87.9111,\"t\":1692385920000,\"n\":4120},{\"v\":452500,\"vw\":88.0084,\"o\":88,\"c\":88.0399,\"h\":88.09,\"l\":87.92,\"t\":1692386820000,\"n\":5053},{\"v\":1.148044e+06,\"vw\":87.994,\"o\":88.0399,\"c\":87.99,\"h\":88.09,\"l\":87.915,\"t\":1692387720000,\"n\":10103},{\"v\":573822,\"vw\":87.9931,\"o\":87.985,\"c\":87.99,\"h\":88.055,\"l\":87.94,\"t\":1692388620000,\"n\":4510},{\"v\":9385,\"vw\":87.9882,\"o\":87.98,\"c\":87.93,\"h\":88.03,\"l\":87.93,\"t\":1692389520000,\"n\":84},{\"v\":2505,\"vw\":87.9572,\"o\":87.94,\"c\":87.95,\"h\":87.97,\"l\":87.93,\"t\":1692390420000,\"n\":43},{\"v\":3271,\"vw\":87.9671,\"o\":87.96,\"c\":87.97,\"h\":87.97,\"l\":87.96,\"t\":1692391320000,\"n\":38},{\"v\":3415,\"vw\":88.0244,\"o\":87.97,\"c\":88.07,\"h\":88.09,\"l\":87.96,\"t\":1692392220000,\"n\":58},{\"v\":7824,\"vw\":88.0389,\"o\":88.06,\"c\":88.0394,\"h\":88.07,\"l\":88,\"t\":1692393120000,\"n\":38},{\"v\":3012,\"vw\":87.8875,\"o\":88.03,\"c\":88.0962,\"h\":88.0962,\"l\":88.03,\"t\":1692394020000,\"n\":36},{\"v\":1048,\"vw\":88.0487,\"o\":88.05,\"c\":88.05,\"h\":88.0591,\"l\":88.04,\"t\":1692394920000,\"n\":17},{\"v\":2532,\"vw\":88.1019,\"o\":88.08,\"c\":88.1,\"h\":88.11,\"l\":88.08,\"t\":1692395820000,\"n\":31},{\"v\":1126,\"vw\":88.099,\"o\":88.1037,\"c\":88.1093,\"h\":88.11,\"l\":88.09,\"t\":1692396720000,\"n\":20},{\"v\":3059,\"vw\":88.0858,\"o\":88.11,\"c\":88.0599,\"h\":88.11,\"l\":88.05,\"t\":1692397620000,\"n\":31},{\"v\":2065,\"vw\":88.023,\"o\":88.05,\"c\":88.03,\"h\":88.05,\"l\":88.01,\"t\":1692398520000,\"n\":22},{\"v\":4325,\"vw\":88.0293,\"o\":88.03,\"c\":88.03,\"h\":88.03,\"l\":88,\"t\":1692399420000,\"n\":11},{\"v\":693,\"vw\":88.0063,\"o\":88.03,\"c\":88.01,\"h\":88.03,\"l\":88,\"t\":1692400320000,\"n\":17},{\"v\":7548,\"vw\":88.0251,\"o\":88,\"c\":88,\"h\":88.11,\"l\":88,\"t\":1692401220000,\"n\":34},{\"v\":9474,\"vw\":87.9358,\"o\":88.05,\"c\":87.91,\"h\":88.05,\"l\":87.9,\"t\":1692402120000,\"n\":49},{\"v\":3268,\"vw\":87.9333,\"o\":87.91,\"c\":87.9,\"h\":87.97,\"l\":87.9,\"t\":1692403020000,\"n\":25}],\"status\":\"DELAYED\",\"request_id\":\"8d74e7ec0090bda7bbd8ccd58a0f490c\",\"count\":311}";
        StackData stackData = gson.fromJson(line, new TypeToken<StackData>() {}.getType());
        List<DataItem> lst = stackData.getResults().subList(0, 3);
        stackData.setResults(lst);
        stackData.setQueryCount(3);
        stackData.setResultsCount(3);
        return gson.toJson(stackData);
    }

    @RequestMapping(value = "/stock_data_0")
    public @ResponseBody
    String stock_data_0(ModelMap model, HttpServletRequest request,
                      HttpServletResponse response,
                      @RequestParam(value = "code", required = false) String code) throws UnsupportedEncodingException {

        StackData stackData = new StackData();
        stackData.setTicker("建发股份");
        stackData.setQueryCount(3000);
        stackData.setResultsCount(3);
        stackData.setAdjusted(false);
        stackData.setStatus("OK");
        stackData.setRequest_id("259dc9cbd44ca8c57f24e26f76613394");
        stackData.setCount(3);

        List<DataItem> lst = new ArrayList<>();
        lst.add(new DataItem(1.12482146e+08d, 36.2195d, 36.45d, 35.06d, 38d, 34.25d, 1182052800000d, 124215d));
        lst.add(new DataItem(9.9606827e+07d, 31.4583d, 35.74d, 29.27d, 35.77d, 28.75d, 1182657600000d, 154356d));
        lst.add(new DataItem(2.050798e+07d, 30.5432d, 29.27d, 31.5d, 31.7d, 29.08d, 1183262400000d, 45794d));

        stackData.setResults(lst);

        Gson gson = new Gson();
        return gson.toJson(stackData);
    }

    @RequestMapping(value = "/stock")
    public String stock(ModelMap model, HttpServletRequest request,
                        HttpServletResponse response,
                        @RequestParam(value = "stock_code", required = false) String stock_code)
    {
        model.addAttribute("one", MyJs.getCode("one.js"));
        model.addAttribute("two", MyJs.getCode("two.js"));
        model.addAttribute("three", MyJs.getCode("three.js"));
        return "stock_2";
    }

    @RequestMapping(value = "/my_stock")
    public String my_stock(ModelMap model, HttpServletRequest request,
                        HttpServletResponse response,
                        @RequestParam(value = "stock_code", required = false) String stock_code)
    {
        model.addAttribute("one", MyJs.getCode("one.js"));
        model.addAttribute("two", MyJs.getCode("two_1.js"));
        model.addAttribute("three", MyJs.getCode("three.js"));
        return "stock_2";
    }

    @RequestMapping(value = "/stock_0")
    public String stock_0(ModelMap model, HttpServletRequest request,
                        HttpServletResponse response,
                        @RequestParam(value = "stock_code", required = false) String stock_code)
    {
        return "stock";
    }

    @RequestMapping(value = "/my_stock_1")
    public String my_stock(ModelMap model, HttpServletRequest request, HttpServletResponse response)
    {
        return "my_stock";
    }

    @RequestMapping(value = "/to_db")
    public @ResponseBody
    String to_db(ModelMap model, HttpServletRequest request,
                      HttpServletResponse response,
                      @RequestParam(value = "symbol", required = false) String symbol,
                      @RequestParam(value = "code", required = false) String code) throws UnsupportedEncodingException, SQLException {
        try {
            toDb_ex(this.conn, code, symbol);
            System.out.println(symbol);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return "1";
    }

    public void toDb_ex(Connection conn, final String line, String symbol) throws SQLException {
        Pattern pattern = Pattern.compile("\\(([^)]+)\\)");
        Matcher matcher = pattern.matcher(line);

        if (matcher.find()) {
            String result = matcher.group(1); // 获取第一个捕获组内容

            LinkedTreeMap m = gson.fromJson(result, new TypeToken<LinkedTreeMap>() {}.getType());
            LinkedTreeMap data = (LinkedTreeMap) m.get("data");
            List klines = (List) data.get("klines");
            //String name = (String) data.get("name");

            for (int i = klines.size() - 1; i >=  klines.size() - 20; i--) {
                //System.out.println(klines.get(i).toString());
                String dl = klines.get(i).toString();
                String[] vs = dl.split(",");
                //List mt = MyUtil.getGson().fromJson(klines.get(i).toString(), new TypeToken<List>() {}.getType());
                //String sql = "insert into df_stock_date (symbol, price, main_fund, main_fund_bf, name, zhangdie, stock_date) values ('" + symbol + "', " + vs[11] + ", " + vs[1] + ", " + vs[6] + ", '" + name + "', " + vs[12] + ", '" + vs[0] + "')";
                //cache.query(new SqlFieldsQuery(sql)).getAll();
                // "2025-05-20,11.40,11.39,11.47,11.37,643635,734455265.82,0.88,0.18,0.02,0.33"
                updateDate_ex(conn, symbol, vs[7], vs[10], vs[0]);
            }

            List<Object> lst = MaiDian.getData(klines);

            List<Integer> rs = MaiDian.get_low(lst);
            for (Integer index : rs) {
                List<Object> row = (List<Object>)lst.get(index);
                update_mai_dian(conn, symbol, row.get(2).toString(), row.get(0).toString());
            }

            List<Float> lsrs = MaiDian.getK(lst, rs);
            Float price_x = MaiDian.get_price_x(lst, rs, lsrs);
            //System.out.println(price_x);
            update_mai_dian_yc(conn, symbol, price_x.toString());
        }
    }

    /**
     * 判断 symbol 的数量是否是 20，如果不是 20，就修改最后一项的数据
     * "2025-05-20,11.40,11.39,11.47,11.37,643635,734455265.82,0.88,0.18,0.02,0.33"
     * price = vs[4]
     * main_fund = vs[4]
     * */
    public void updateDate_ex(Connection conn, String symbol, String zhengfu, String huanshoulv, String stock_date) throws SQLException {
        // 修改最后一项的数据
        Long pkid = getSymbolLastId_ex(conn, symbol, stock_date);
        String sql = "update df_stock_date SET zhengfu = "+ zhengfu +", huanshoulv = "+ huanshoulv +" WHERE id = " + pkid.toString();
        //cache.query(new SqlFieldsQuery(sql)).getAll();
        Statement stmt = conn.createStatement();
        stmt.execute(sql);
    }

    /**
     * 获取 Symbol 的个数
     * */
    public Long getSymbolLastId_ex(Connection conn, String symbol, String stock_date) {
        String sql = "select id from df_stock_date where symbol = '"+ symbol +"' and stock_date = '"+ stock_date +"'";
        PreparedStatement stmt = null;
        ResultSet rs = null;
        long id = 0L;

        try {
            stmt = conn.prepareStatement(sql);

            // 5. 执行查询并获取结果集
            rs = stmt.executeQuery();

            // 6. 遍历结果集并处理数据
            while (rs.next()) {
                id = rs.getLong(1);
            }

        } catch (SQLException e) {
            System.err.println("数据库操作失败！错误信息：" + e.getMessage());
            e.printStackTrace();
        } finally {
            // 7. 关闭资源（反向顺序）
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        return id;
    }

    public void update_mai_dian_yc(Connection conn, String symbol, String price) throws SQLException {
        // 修改最后一项的数据
        String pkid = getmai_dian_ycId(conn, symbol);
        if (pkid != null) {
            String sql = "update mai_dian_yc SET price = " + price + " WHERE symbol = '" + pkid + "'";
            //cache.query(new SqlFieldsQuery(sql)).getAll();
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
        } else {
            String sql = "insert into mai_dian_yc (symbol, price) values ('" + symbol + "', " + price + ")";
            //cache.query(new SqlFieldsQuery(sql)).getAll();
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
        }
    }

    public void update_mai_dian(Connection conn, String symbol, String price, String stock_date) throws SQLException {
        // 修改最后一项的数据
        Long pkid = getmai_dianId(conn, symbol, stock_date);
        if (pkid > 0L) {
            String sql = "update mai_dian SET price = " + price + ", stock_date = '" + stock_date + "' WHERE id = " + pkid.toString();
            //cache.query(new SqlFieldsQuery(sql)).getAll();
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
        } else {
            String sql = "insert into mai_dian (id, symbol, price, stock_date) values (" + getmai_dianLastId(conn) + ", '" + symbol + "', " + price + ", '" + stock_date + "')";
            //cache.query(new SqlFieldsQuery(sql)).getAll();
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
        }
    }

    /**
     * 获取 stock_date 的id
     * */
    public String getmai_dian_ycId(Connection conn, String symbol) {
        String sql = "select symbol from mai_dian_yc where symbol = '"+ symbol +"'";
        PreparedStatement stmt = null;
        ResultSet rs = null;
        String symbol_id = null;

        try {
            stmt = conn.prepareStatement(sql);

            // 5. 执行查询并获取结果集
            rs = stmt.executeQuery();

            // 6. 遍历结果集并处理数据
            while (rs.next()) {
                symbol_id = rs.getString(1);
            }

        } catch (SQLException e) {
            System.err.println("数据库操作失败！错误信息：" + e.getMessage());
            e.printStackTrace();
        } finally {
            // 7. 关闭资源（反向顺序）
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        return symbol_id;
    }

    /**
     * 获取 stock_date 的id
     * */
    public Long getmai_dianId(Connection conn, String symbol, String stock_date) {
        String sql = "select id from mai_dian where symbol = '"+ symbol +"' and stock_date = '"+ stock_date +"'";
        PreparedStatement stmt = null;
        ResultSet rs = null;
        long id = 0L;

        try {
            stmt = conn.prepareStatement(sql);

            // 5. 执行查询并获取结果集
            rs = stmt.executeQuery();

            // 6. 遍历结果集并处理数据
            while (rs.next()) {
                id = rs.getLong(1);
            }

        } catch (SQLException e) {
            System.err.println("数据库操作失败！错误信息：" + e.getMessage());
            e.printStackTrace();
        } finally {
            // 7. 关闭资源（反向顺序）
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        return id;
    }

    public Long getmai_dianLastId(Connection conn) {
        String sql = "select count(id) from mai_dian";
        PreparedStatement stmt = null;
        ResultSet rs = null;
        long id = 0L;

        try {
            stmt = conn.prepareStatement(sql);

            // 5. 执行查询并获取结果集
            rs = stmt.executeQuery();

            // 6. 遍历结果集并处理数据
            while (rs.next()) {
                id = rs.getLong(1);
            }

        } catch (SQLException e) {
            System.err.println("数据库操作失败！错误信息：" + e.getMessage());
            e.printStackTrace();
        } finally {
            // 7. 关闭资源（反向顺序）
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        return id + 1L;
    }
}




































